#include <stdio.h>


void speaking()
{
    printf("animal speaking...\n");
}
struct func_op{
    void (*fp1)(void);
    void (*fp2)(void);
    void (*fp3)(void);
    void (*fp4)(void);
};
struct animal{
    int age;
    int weight;
    struct func_op fp;
};
struct cat{
    struct animal *p;
    struct animal ani;
    char sex;
};
int main(void)
{
    struct animal ani;
    ani.age=1;
    ani.weight=2;
    ani.fp.fp2=speaking;
    printf("ani:%d %d\n",ani.age,ani.weight);
    ani.fp.fp2();

    printf("go to cat\n");
    struct cat c;
    c.p=&ani;
    c.p->fp.fp2();
    c.sex='f';
    printf("cat:%d %d\n",c.p->age,c.p->weight);
    printf("cat sex:%c\n",c.sex);
    return 0;
}
